import lejos.nxt.*;

public class Main {

	public static void main(String[] args) {
		System.out.println("Press any button to start the program!");
		Button.waitForPress();
		LCD.clear();
		System.out.println("Press ESCAPE to abort program");
		DistanceMonitor frontMonitor = new DistanceMonitor();
		DistanceMonitor rearMonitor = new DistanceMonitor();
		DistanceMonitor sideMonitor = new DistanceMonitor();

		UltrasonicSensor sonicFront = new UltrasonicSensor(SensorPort.S1);
		UltrasonicSensor sonicRear = new UltrasonicSensor(SensorPort.S2);
		UltrasonicSensor sonicSide = new UltrasonicSensor(SensorPort.S3);

		DistanceSensor frontSensor = new DistanceSensor(frontMonitor,
				sonicFront);
		DistanceSensor rearSensor = new DistanceSensor(rearMonitor, sonicRear);
		DistanceSensor sideSensor = new DistanceSensor(sideMonitor, sonicSide);
		Controller cont = new Controller(frontMonitor, rearMonitor, sideMonitor);
		rearSensor.start();
		frontSensor.start();
		sideSensor.start();
		cont.start();
		new ButtonListener().start();
	}
}